import { _decorator, Component, Node, resources, SpriteFrame } from 'cc'
import Singleton from '../Base/Singleton'
const { ccclass, property } = _decorator

export class ResourceManager extends Singleton {
  loadDirectory(path: string, type: typeof SpriteFrame = SpriteFrame) {
    return new Promise<SpriteFrame[]>((resolve, reject) => {
      resources.loadDir(path, type, function (err, assets) {
        if (err) {
          reject(err)
          return
        }

        resolve(assets)
      })
    })
  }
}
